import type { Member } from '@/types/member'
import { http } from '@/utils/http'

type LoginWxMinParams = {
  code: string
  encryptedData?: string
  iv?: string
}
/**
 * 小程序登录
 * @param data 请求参数
 */
export const postLoginWxMinAPI = (data: LoginWxMinParams) => {
  return http<Member>({
    method: 'POST',
    url: '/api/member/wxLogin',
    data,
  })
}

/**
 * 小程序登录_内测版
 * @param phone 模拟手机号码
 */
export const postLoginWxMinSimpleAPI = (phone: string) => {
  return http<Member>({
    method: 'POST',
    url: '/api/member/wxLoginDemo',
    data: {
      phone,
    },
  })
}
